<template>
  <div class="wrapper" >
      <div class="box1">
        <h1>获取权限</h1>
        <el-button @click="roleA" type="primary">获取A的权限</el-button>
        <el-button @click="roleB" type="primary">获取B的权限</el-button>
        <el-button @click="roleC" type="primary">获取C的权限</el-button>
      </div>
  </div>
</template>
<script>
import eventEmitter from '@/utils/EventEmitter'
import {getUserRoleInfoA,getUserRoleInfoB,getUserRoleInfoC } from '@/model/role/role' 

export default {
  name: 'Role',
  methods:{
    async roleA(){
      const { data } = await getUserRoleInfoA()
      eventEmitter.emit('userRole', data.role)
      await this.$router.push('/show');
      eventEmitter.emit('userButtonRole', data.buttonRole);
    },
    async roleB(){
      const { data } = await getUserRoleInfoB()
      eventEmitter.emit('userRole', data.role)
      await this.$router.push('/show');
      eventEmitter.emit('userButtonRole', data.buttonRole);
    },
    async roleC(){
      const { data } = await getUserRoleInfoC()
      eventEmitter.emit('userRole', data.role)
      await this.$router.push('/show');
      eventEmitter.emit('userButtonRole', data.buttonRole);
    }
  }
}
</script>